import Http from "@/http";
import { dictionaryItemByCategoryApi } from "../system/Dictionary";

export function saveApi(params:any) {
    return params.id ? Http.put('deviceCommand/update', params) : Http.post('deviceCommand/add', params)
}



export function deleteApi(id) {
    return Http.delete('deviceCommand/delete/' + id)
}


export function listApi(deviceTypeId) {
    return Http.get('deviceCommand/list/' + deviceTypeId)
}

export function deviceTypeOptionsApi() {
    return Http.get('deviceCommand/options')
}

export function getParamsFieldApi(id:number) {
    return Http.get('deviceCommand/paramsField/' + id)
}

export async function commandParamsTypeApi() {
    const r = await dictionaryItemByCategoryApi('COMMAND_PARAMS_TYPE')
    return r.data || []
}

